package com.thon.dao.project.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.thon.dao.project.ProjectScheduleDao;
import com.thon.dao.util.AbstractDao;
import com.thon.entity.project.ProjectSchedule;

@Repository
public class ProjectScheduleDaoImpl extends AbstractDao<ProjectSchedule> implements ProjectScheduleDao {

	public ProjectScheduleDaoImpl() {
		super(ProjectSchedule.class);
	}


	@Override
	public List<ProjectSchedule> listProjectSchedules(int pid) {
		
		String queryString = "FROM ProjectSchedule ps WHERE ps.project.id = ? ORDER BY ps.stage ASC";
		
		return findList(queryString, null, pid);
	}


	@Override
	public ProjectSchedule getProjectSchedule(Integer stage, Integer projectId) {
		
		String queryString ="FROM ProjectSchedule ps WHERE stage = ? AND ps.project.id = ?";
		return findOne(queryString, null,stage,projectId);
	}

}
